package com.zheng.oa.common.constant.enums;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

/**
 * Created by IntelliJ IDEA.
 * User: xinqi
 * Date: 2018/3/26
 * Time: 10:29
 */
public enum OaStatus {
    NORMAL(0, "正常"),
    DELETED(1, "已删除");
    private Integer key;
    private String value;

    OaStatus(Integer key, String value) {
        this.key = key;
        this.value = value;
    }

    public Integer getKey() {
        return key;
    }

    public void setKey(Integer key) {
        this.key = key;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static JSONArray getAll() {
        JSONArray jsonArray = new JSONArray();
        for (OaStatus status : values()) {
            JSONObject json = new JSONObject();
            json.put("key", status.getKey());
            json.put("value", status.getValue());
            jsonArray.add(json);
        }
        return jsonArray;
    }
}
